package com.cml.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author cml
 * @create 2021/4/21 10:42
 */
@Configuration
public class GateWayConfig {
    @Bean
    public RouteLocator routeLocator(RouteLocatorBuilder locatorBuilder){
        RouteLocatorBuilder.Builder routes = locatorBuilder.routes();
        routes.route("path-router-cml",r -> r.path("/guoji").uri("http://news.baidu.com/guoji"));
        routes.route("path-router-cml2",r -> r.path("/guonei").uri("http://news.baidu.com/guonei"));
        return routes.build();
    }
}
